//
//  MyOrderView.m
//  ShopDemo
//
//  Created by 飞扬的青春 on 2018/7/11.
//  Copyright © 2018年 飞扬的青春. All rights reserved.
//

#import "MyOrderView.h"

@implementation MyOrderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UILabel *lab = [UILabel new];
        lab.font = [UIFont systemFontOfSize:16*kJLXWidthScale];
        lab.textColor = [UIColor blackColor];
        lab.textAlignment = NSTextAlignmentLeft;
        lab.text = @"我的订单";
        [self addSubview:lab];
        lab.sd_layout
        .topSpaceToView(self, 0)
        .leftSpaceToView(self, 10*kJLXWidthScale)
        .rightSpaceToView(self, 10*kJLXWidthScale)
        .heightIs(40*kJLXWidthScale);
        NSArray *arr = @[@"待支付",@"待发货",@"待收货",@"待评价"];
        NSArray *nameArr = @[@"MineTwo.png",@"MineFour.png",@"MineThird.png",@"MineOne.png"];
        for (int i = 0; i < 4 ; i ++) {
            MineButton *btn = [MineButton new];
            NSInteger widthnum = kScreenWidth/4;
//            NSInteger space = (kScreenWidth-4*60*kJLXWidthScale)/5;
            [self addSubview:btn];
            btn.sd_layout
            .topSpaceToView(lab, 0)
            .bottomSpaceToView(self, 0)
            .widthIs(widthnum)
            .leftSpaceToView(self, widthnum*i);
            btn.mineimagevi = [UIImageView new];
            btn.mineimagevi.image = [UIImage imageNamed:nameArr[i]];
            btn.mineimagevi.backgroundColor = [UIColor whiteColor];
            [btn addSubview:btn.mineimagevi];
            btn.mineimagevi.sd_layout
            .topSpaceToView(btn, 0)
            .centerXEqualToView(btn)
            .heightIs(btn.height - 30*kJLXWidthScale)
            .widthIs(btn.height - 30*kJLXWidthScale);
            btn.minlab = [UILabel new];
            btn.minlab.textAlignment = NSTextAlignmentCenter;
            btn.minlab.font = [UIFont systemFontOfSize:16*kJLXWidthScale];
            btn.minlab.textColor = [UIColor blackColor];
            btn.minlab.text = arr[i];
            [btn addSubview:btn.minlab];
            btn.minlab.sd_layout
            .topSpaceToView(btn.mineimagevi, 0)
            .centerXEqualToView(btn)
            .heightIs(30*kJLXWidthScale)
            .widthIs(widthnum);
            if (i == 0) {
                self.oneBtn = btn;
            }else if (i == 1){
                self.twoBtn = btn;
            }else if (i == 2){
                self.thirdBtn = btn;
            }else if (i == 3){
                self.fourBtn = btn;
            }
        }
        
        
    }
    return self;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
